#pragma once

#include <GL\freeglut.h>
#include "point3D.h"
#include "../utilities/mathematic.h"

#include "../utilities/ext/TextureLoader.h"

class Surface
{

public:
	enum Type
	{
		REVOLUTION = 0,
		SWEPT
	};

public:
	Surface(int slices,int stacks);

	Surface(const char* texturePath,int slices,int stacks);

	void Init();

	virtual ~Surface();

	void Update(float dt);
	
	void Render();

	void SetPolygonMode(GLenum face, GLenum mode);

	GLenum GetPolygonMode();

	void ShowTexture(bool show);

	virtual Type GetType() = 0;

	
protected:

	virtual void loadIndexArray() = 0;
	virtual void loadVertexArray() = 0;
	virtual void loadTextureCoordArray() = 0;
	virtual void loadNormalArray() = 0;

protected:

	unsigned int m_slices;
	unsigned int m_stacks;

	std::vector<unsigned int>	m_indices;
	std::vector<float>			m_vertices;
	std::vector<float>			m_textureCoords;
	std::vector<float>			m_normals;

	//Polygon Mode
	GLenum m_polygonModeFace;
	GLenum m_polygonMode;

	const char*		m_texturePath;
	TextureLoader*	m_textureLoader;
	glTexture*		m_texture;
	
	bool			m_showTexture;

};

